<?php

namespace Blog\TagLib;

use Think\Template\TagLib;

/**
 * 通用标签库解析类
 */
class blog extends TagLib {
    protected $tags = array(
        // 标签定义： attr 属性列表 close 是否闭合（0 或者1 默认1） alias 标签别名 level 嵌套层次
        'article' => array('attr' => 'file', 'close' => 0),
    );
    public function _article($tags) {
        $code = '<volist name="'.$tags['list'].'" id="vo">';
        $code .= '<article class="blog-teaser">
                    <header>
                        <div class="post-img">
                        <empty name="vo.img">
                        <img src="__SRC__/img/no.jpg"/>
                        <else/>
                            <img src="{$vo.img}" alt="{$vo.title}" />
                        </empty>
                        </div>
                        <h3><a href="{:addon_url("Article/view",["id"=>$vo["id"]])}">{$vo.title}</a></h3>
                        <span class="meta"><i class="fa fa-calendar"></i> {$vo.post_date}&nbsp;&nbsp;<i class="fa fa-comments"></i> {$vo.comments}&nbsp;&nbsp;<i class="fa fa-eye"></i> {$vo.view}</span>
                        <hr>
                    </header>
                    <div class="body">{$vo.summary}</div>
                    <div class="clearfix">
                        <a href="{:addon_url("Article/view",["id"=>$vo["id"]])}" class="btn btn-clean-one">Read more</a>
                    </div>
                </article></volist>';
        return $code;
    }
}